package cn.initcap;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.util.Collector;

/**
 * @author initcap
 * @date Created in 8/28/19 9:24 PM.
 */
public class MyFlatMapFunction implements FlatMapFunction<String, WordCount> {

    @Override
    public void flatMap(String value, Collector<WordCount> collector) throws Exception {
        String[] tokens = value.split(",");
        for (String token : tokens) {
            collector.collect(new WordCount(token, 1));
        }
    }

}
